<%@ Page Language="C#" %>
<script runat="server">
    private const string NoPic = "/Images/no_pic.gif";
    private void Page_Load(object sender, System.EventArgs e)
    {
        Response.Clear();
        if (string.IsNullOrEmpty(Request["UserID"]))
        {
            Response.Write(" $/Images/no_pic.gif");
        }
        else
        {
            string strUserID = Request["UserID"];
            string tmp = "T";
            for (int i = 0; i < 9 - strUserID.Length; i++)
            {
                tmp += "0";
            }
            strUserID = tmp + strUserID;
            
            string Avatar = NoPic;
            string NickName = "";
            using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["www_user.user"].ConnectionString))
            {
                System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("select NickName,Avatar from t_user where memberno='" + strUserID + "'", conn);
                conn.Open();
                try
                {
                    System.Data.SqlClient.SqlDataReader dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        NickName = dr[0].ToString();
                        Avatar = dr[1].ToString();
                        Avatar = (Avatar.Trim() == "" ? NoPic : Avatar);
                        break;
                    }
                    dr.Close();
                    conn.Close();
                }
                catch { }
            }
            Response.Write(" "+NickName + "$" + Avatar);
        }
    }
</script>
